import { defineStore } from "pinia";
import { store } from "~/store/index";

export const useGlobalStore = defineStore("global", {
  state: () => ({ count: 0 }),
  getters: {
    double: (state) => state.count * 2,
  },
  actions: {
    increment() {
      this.count++;
    },
  },
});

// 自动分配类型
export function useGlobalStoreHook() {
  return useGlobalStore(store);
}
